<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./assets/font/iconfont.css">
    <style>
        html {
            background-color: #333;
        }

        .box {
            width: 540px;
            height: 400px;
            background-color: #fecd85;
            margin: 0 auto;
            position: relative;
        }

        .tabbar {
            width: 100%;
            height: 80px;
            background-color: white;
            position: absolute;
            bottom: 0px;
            left: 0px;
        }

        .btns {
            display: flex;
            flex-flow: row nowrap;
            height: 100%;
            align-items: center;
        }

        .btns .btn {
            flex-grow: 1;
            /* height: 100%; */
            text-align: center;
            font-weight: bold;
            cursor: pointer;
        }

        .btns .btn .iconfont {
            font-size: 30px;
        }

        .btns .btn.active .iconfont {
            background-color: white;
            opacity: 0;
            transform: translate(0px, 40px);
            animation: show 400ms ease forwards;
            z-index: 9;
            position: absolute;
            top: -40%;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            line-height: 60px;
        }

        @keyframes show {
            0% {
                opacity: 0;
                top: -40%;
            }

            40% {
                opacity: 0;
                top: -40%;
            }

            100% {
                opacity: 1;
                top: -80%;

            }
        }

        .pot {
            position: absolute;
            top: 0px;
            left: 0px;
            height: 70%;
            width: 25%;
            /* background-color: #ccc; */
            overflow: hidden;
            transition: all 400ms ease;
        }

        .pot .round {
            background-color: #fecd85;
            height: 60px;
            width: 72px;
            border-radius: 0 0 50% 50%;
            margin: 0 auto;
            transform: translate(0, -16px);
        }

        .pot .left,
        .pot .right {
            width: 65px;
            height: 50px;
            border-radius: 50%;
            background-color: transparent;
            position: absolute;
            top: 0px;
            box-shadow: 0 -30px 0px #fecd85;
        }

        .pot .left {
            left: -32px;
            box-shadow: 4px -16px 0px #fecd85;
        }

        .pot .right {
            right: -32px;
            box-shadow: -4px -16px 0px #fecd85;
        }
    </style>
</head>

<body>
    <div class="box">

        <div class="tabbar">

            <div class="btns">
                <div class="btn active">
                    <div class="iconfont icon-wode" style="left:7%"></div>
                </div>
                <div class="btn">
                    <div class="iconfont icon-shouye"></div>
                </div>
                <div class="btn">
                    <div class="iconfont icon-tixing"></div>
                </div>
                <div class="btn">
                    <div class="iconfont icon-tuite"></div>
                </div>
            </div>
            <div class="pot">
                <div class="left"></div>
                <div class="round"></div>
                <div class="right"></div>
            </div>

        </div>

    </div>
    <script>
        let btns = document.querySelectorAll(".btn");
        let pot = document.querySelector(".pot")
        btns.forEach(function (itemDom, i) {
            itemDom.addEventListener("click", function () {
                // 行内样式删除操作
                btns.forEach(tempDom => tempDom.classList.remove("active"));
                pot.style.left = 25 * i + "%";
                let icon = itemDom.querySelector(".iconfont")
                icon.style.left = 25 * i + 7 +"%";
                itemDom.classList.add("active");
            })
        })
    </script>
</body>

</html>